package com.hmall.order.config;

import com.hmall.order.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auth：Yang Zhen
 * @Desc：注册 order-service Interceptor 拦截器
 * @Date：2023/4/20 8:58
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册 AuthorizationInterceptor 到拦截器，"/**" 拦截所有请求
        registry.addInterceptor(new AuthorizationInterceptor()).addPathPatterns("/**");
    }

}
